package com.mew.common.entity.record;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mew.common.entity.user.Profile;
import com.mew.common.rest.game.BetAfterRequest;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;


@TableName("r_play_record")
@Data
@ToString
@NoArgsConstructor
public class PlayRecord  {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 关联ID
     */
    @TableField("relate_inout_id")
    private Long relateInoutId;
    @TableField("user_id")
    private Long userId;
    @TableField("game_id")
    private Integer gameId;
    /**
     * 房间ID
     */
    @TableField("room_id")
    private Integer roomId;
    @TableField("table_id")
    private Integer tableId;
    @TableField("seat_no")
    private Integer seatNo;
    /**
     * 设备类型【0, 未知，1正常手机，2，模拟器，3，云手机】
     */
    @TableField("devices_type")
    private Integer devicesType;
    /**
     * 押注信息
     */
    @TableField("bet_array")
    private String betArray;
    /**
     * 押注金额
     */
    @TableField("bet_number")
    private Long betNumber;
    /**
     * 赔付
     */
    @TableField("payment_number")
    private Long paymentNumber;

    @TableField("payment_array")
    private String paymentArray;
    /**
     * 倍数
     */
    @TableField("payment_times")
    private Integer paymentTimes;
    /**
     * 押注返回图标
     */
    @TableField("icon_result")
    private String iconResult;
    @TableField("banker_result")
    private String bankerResult;
    /**
     * 压住前_背包数量
     */
    @TableField("after_gold_num")
    private Long afterGoldNum;
    @TableField("after_level_id")
    private Integer afterLevelId;

    @TableField("ino")
    private Long ino;





    public void  buildData(BetAfterRequest request, Profile profile){
        this.userId = request.getUid();
        this.relateInoutId = request.getRelateInoutId();
        this.gameId = request.getGameId();
        this.roomId = request.getRoomId();
        this.tableId = request.getTableId();
        this.seatNo = request.getSeatNo();
        this.betArray = request.getBetArray();
        this.betNumber = request.getBet();
        this.paymentNumber = request.getPayment();
        this.paymentArray = request.getPaymentArray();
        this.paymentTimes = request.getBetTimes();
        this.iconResult = request.getIconResult();
        this.bankerResult = request.getBankerResult();
        this.afterGoldNum = profile.getGoldNumber();
        this.afterLevelId = profile.getUserLevel();
        this.ino = request.getIno();
    }

}
